/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author HASSAN
 */
import java.sql.DriverManager;
import  java.sql.Connection;
import java.sql.Statement;
//import java.sql.Driver;
//import java.net.*;
//import java.lang.*;
public class connexion {
                 private  String url = "jdbc:oracle:thin:@localhost:1521/XE";
                 private  String user = "gestion";
                 private String passwd = "123456789";
                 private static Connection connect;
         private  connexion(){              
                        try {
                                 connect = DriverManager.getConnection(url, user, passwd);
                                 System.out.println("Connexion");
                            } catch (Exception e) {
                              e.printStackTrace();
                              }
          }
   public static Connection getInstance(){
if(connect == null){
                       new connexion();
                     System.out.println("INSTANCIATION DE LA CONNEXION SQL ! ");
            }
          else{
                          System.out.println("CONNEXION SQL EXISTANTE ! ");
                        }
return connect;
}
    
 /*   
public static void main(String[] args) {
         try {
                Class.forName("oracle.jdbc.OracleDriver");
                System.out.println("Driver O.K.");
                 String url = "jdbc:oracle:thin:@localhost:1521/XE";
                 String user = "gestion";
                  String passwd = "123456789";
                  Connection conn = DriverManager.getConnection(url, user, passwd);
                  System.out.println("Connexion effective !");
                } 
         catch (Exception e) 
               {
                  e.printStackTrace();
                   System.out.println("Driver NO");
                }
}
*/    

    Statement createStatement() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }


}